/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package com.pj.api.controller;


import cn.dev33.satoken.stp.StpUtil;
import com.pj.utils.sg.AjaxJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * APP测试接口
 *
 * @author Mark sunlightcs@gmail.com
 */
@RestController
@RequestMapping("/app")
@Api(tags = "APP测试接口")
public class AppTestController {


    @GetMapping("userInfo")
    @ApiOperation("获取用户信息")
    public AjaxJson getUserInfo(){

        return AjaxJson.getSuccess().setData(StpUtil.getLoginId());
    }


    @GetMapping("userId")
    @ApiOperation("获取用户ID")
    public AjaxJson getUserId(){
        return AjaxJson.getSuccess("userId", StpUtil.getLoginId());
    }

    @GetMapping("notToken")
    @ApiOperation("忽略Token验证测试")
    public AjaxJson notToken(){
        return AjaxJson.getSuccess().setData("无需token也能访问。。。");
    }

}
